<template>
  <div class="nav">
    <el-breadcrumb separator-class="el-icon-more">
      <el-breadcrumb-item
        v-for="(item, index) of navList"
        :key="index"
        :to="{ path: item.path }"
        >{{ item.meta.title }}</el-breadcrumb-item
      >
    </el-breadcrumb>
  </div>
</template>
<script>
import store from "@/store";
export default {
  name: "Nav",
  data() {
    return {
      store,
      navList: [],
    };
  },
  watch: {
    $route: {
      immediate: true,
      handler(value) {
        this.navList = value.matched.filter(
          (item) => item.meta && item.meta.title
        );
      },
    },
  },
};
</script>

<style lang="scss" scoped>
.nav {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>